<template>
  <ClDialog v-bind="$attrs" :title="getTitle" width="40%">
    <div>123456</div>
    <!-- <ClForm ref="refForm" label-width="110" :form-item="formItem" /> -->
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="emit('atClose')">取消</el-button>
        <el-button type="primary" @click="onSure">确定</el-button>
      </span>
    </template>
  </ClDialog>
</template>

<script setup lang="ts">
import { computed } from 'vue'
let refForm = ref<any>(null)
const submitForm = async (val) => {
  try {
    if (props.info.id) {
      // 更新
    } else {
      // 新增
    }
    emit('atClose', 'refresh-table')
  } catch (error) {
    console.log('🐷 🐽 submitForm 🐽 error👉👉👉', error)
  }
}
const onSure = () => {
  refForm.value?.onsubmit(submitForm)
}
const getTitle = computed(() => {
  return props.type
})

interface infoType {
  [props: string]: any
}
const props = defineProps<{ info: infoType; type: string }>()

const emit = defineEmits<{
  (e: 'atClose', str?: string | undefined): void
}>()
</script>

<style scoped lang="scss"></style>
